Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: token provider #6927

Closed
wants to merge 4 commits into from
Closed

feat: token provider #6927

wants to merge 4 commits into from

Conversation

ThangHuuVu
Copy link
Member

@ThangHuuVu ThangHuuVu commented Mar 12, 2023

☕️ Reasoning

This PR introduces the following changes:

  • add tokenId and tokenIdVerified to AdapterUser. We set them similar to how we set email and emailVerified. email and emailVerified are kept around to keep migration effort low.
  • adapter.getUserByEmail is changed to adapter.getUserByTokenId. This requires a lot of changes to follow in the adapters package.
  • add a Token provider. By default, it will throw an error for sendVerificationToken, signaling that if the developer use this provider, they should implement this method.
  • Email provider is now SmtpEmail provider with specific settings for SMTP-based email servers. It works just like before, the name changing should not break anything, since this is a default export. This is to distinguish with the other HTTP-based email provider that we want to add in the future, like SendGrid.

🧢 Checklist

  • Documentation
  • Tests
  • Ready to be merged

🎫 Affected issues

Please scout and link issues that might be solved by this PR.

Addressing #1465

📌 Resources

@vercel
Copy link

vercel bot commented Mar 12, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
auth-docs ❌ Failed (Inspect) Aug 25, 2023 4:46am
2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
auth-docs-nextra ⬜️ Ignored (Inspect) Visit Preview Aug 25, 2023 4:46am
next-auth-docs ⬜️ Ignored (Inspect) Visit Preview Aug 25, 2023 4:46am

@github-actions github-actions bot added adapters Changes related to the core code concerning database adapters core Refers to `@auth/core` providers labels Mar 12, 2023
Copy link
Member

@balazsorban44 balazsorban44 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking that we could refactor things in a way that the email provider essentially just implements the token provider, so we don't need another provider type, just renaming "email" to "token" internally.

@github-actions github-actions bot added firebase @auth/firebase-adapter prisma @auth/prisma-adapter dynamodb @auth/dynamodb-adapter fauna @auth/fauna-adapter mikro-orm @auth/mikro-orm-adapter dgraph @auth/dgraph-adapter mongodb @auth/mongodb-adapter neo4j @auth/neo4j-adapter pouchdb @auth/pouchdb-adapter sequelize @auth/sequelize-adapter upstash-redis @auth/upstash-redis-adapter supabase @auth/supabase-adapter typeorm @auth/typeorm-adapter xata @auth/xata-adapter kysely labels Aug 19, 2023
@ThangHuuVu
Copy link
Member Author

@balazsorban44 do you think we should 🚢 this with v5? Let me know what you think of the current state of this PR. 👀

@philbaker4
Copy link

philbaker4 commented Oct 5, 2023

Cross posting my RFC #1465 comment for reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adapters Changes related to the core code concerning database adapters core Refers to `@auth/core` dgraph @auth/dgraph-adapter dynamodb @auth/dynamodb-adapter fauna @auth/fauna-adapter firebase @auth/firebase-adapter kysely mikro-orm @auth/mikro-orm-adapter mongodb @auth/mongodb-adapter neo4j @auth/neo4j-adapter pouchdb @auth/pouchdb-adapter prisma @auth/prisma-adapter providers sequelize @auth/sequelize-adapter supabase @auth/supabase-adapter typeorm @auth/typeorm-adapter upstash-redis @auth/upstash-redis-adapter xata @auth/xata-adapter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants